package Class_03_22;

class Animal2
{
    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Animal2(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Animal2() {
    }
}

//继承
class Cat extends Animal2{
    private String color;

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }
}

public class AnimalTest2 {
    public static void main(String[] args) {
        Cat cat = new Cat();
        cat.setName("小花");
        cat.setAge(4);
        cat.setColor("白色");//访问的是cat类的方法

        System.out.println("名称:" + cat.getName() + "  " + "年龄:" + cat.getAge() + "  " + "颜色" + cat.getColor());
    }
}
